package com.zcg.blogger.service;

import static org.junit.Assert.*;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.zcg.blogger.mapping.SpringTest;
import com.zcg.blogger.model.User;
import com.zcg.blogger.service.UserService;

public class UserServiceImpl extends SpringTest{
	
	private static Logger logger = Logger.getLogger(UserServiceImpl.class);
//	private ApplicationContext ac = null;
	@Resource
	private UserService userService = null;
	
	@Test
	public void check(){
		User user = userService.check("张晨刚", "a4069825");
		System.out.println(user+""+user.getAvatar());
	}
	
	/**
	 * 像指定邮箱发送验证码
	 * @param 邮箱
	 * @throws Exception 
	 */
	@Test
	public void sendCheckCode() throws Exception{
		userService.sendCheckCode("1169509982@qq.com");
		
	}
	
	@Test
	public void updateEmail(){
		userService.updateEmail("1169509982@qq.com", "1234", 11);
	}
	
	@Test
	public void updatePassword(){
		userService.updatePassword("asdfgh", "zhang", 11);
	}
	
	@Test
	public void updateAvatar(){
		userService.updateAvatar("resources/images/itemall/1006_Rejuvenation_Bead.png", 5);
	}
}
